home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / usr / lib / python2.6 / curses / ascii.pyc (.txt) < prev    next >
Python Compiled Bytecode  |  2009-11-11  |  5KB  |  191 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. '''Constants and membership tests for ASCII characters'''
  5. NUL = 0
  6. SOH = 1
  7. STX = 2
  8. ETX = 3
  9. EOT = 4
  10. ENQ = 5
  11. ACK = 6
  12. BEL = 7
  13. BS = 8
  14. TAB = 9
  15. HT = 9
  16. LF = 10
  17. NL = 10
  18. VT = 11
  19. FF = 12
  20. CR = 13
  21. SO = 14
  22. SI = 15
  23. DLE = 16
  24. DC1 = 17
  25. DC2 = 18
  26. DC3 = 19
  27. DC4 = 20
  28. NAK = 21
  29. SYN = 22
  30. ETB = 23
  31. CAN = 24
  32. EM = 25
  33. SUB = 26
  34. ESC = 27
  35. FS = 28
  36. GS = 29
  37. RS = 30
  38. US = 31
  39. SP = 32
  40. DEL = 127
  41. controlnames = [
  42.     'NUL',
  43.     'SOH',
  44.     'STX',
  45.     'ETX',
  46.     'EOT',
  47.     'ENQ',
  48.     'ACK',
  49.     'BEL',
  50.     'BS',
  51.     'HT',
  52.     'LF',
  53.     'VT',
  54.     'FF',
  55.     'CR',
  56.     'SO',
  57.     'SI',
  58.     'DLE',
  59.     'DC1',
  60.     'DC2',
  61.     'DC3',
  62.     'DC4',
  63.     'NAK',
  64.     'SYN',
  65.     'ETB',
  66.     'CAN',
  67.     'EM',
  68.     'SUB',
  69.     'ESC',
  70.     'FS',
  71.     'GS',
  72.     'RS',
  73.     'US',
  74.     'SP']
  75.  
  76. def _ctoi(c):
  77.     if type(c) == type(''):
  78.         return ord(c)
  79.     return c
  80.  
  81.  
  82. def isalnum(c):
  83.     if not isalpha(c):
  84.         pass
  85.     return isdigit(c)
  86.  
  87.  
  88. def isalpha(c):
  89.     if not isupper(c):
  90.         pass
  91.     return islower(c)
  92.  
  93.  
  94. def isascii(c):
  95.     return _ctoi(c) <= 127
  96.  
  97.  
  98. def isblank(c):
  99.     return _ctoi(c) in (8, 32)
  100.  
  101.  
  102. def iscntrl(c):
  103.     return _ctoi(c) <= 31
  104.  
  105.  
  106. def isdigit(c):
  107.     if _ctoi(c) >= 48:
  108.         pass
  109.     return _ctoi(c) <= 57
  110.  
  111.  
  112. def isgraph(c):
  113.     if _ctoi(c) >= 33:
  114.         pass
  115.     return _ctoi(c) <= 126
  116.  
  117.  
  118. def islower(c):
  119.     if _ctoi(c) >= 97:
  120.         pass
  121.     return _ctoi(c) <= 122
  122.  
  123.  
  124. def isprint(c):
  125.     if _ctoi(c) >= 32:
  126.         pass
  127.     return _ctoi(c) <= 126
  128.  
  129.  
  130. def ispunct(c):
  131.     if _ctoi(c) != 32:
  132.         pass
  133.     return not isalnum(c)
  134.  
  135.  
  136. def isspace(c):
  137.     return _ctoi(c) in (9, 10, 11, 12, 13, 32)
  138.  
  139.  
  140. def isupper(c):
  141.     if _ctoi(c) >= 65:
  142.         pass
  143.     return _ctoi(c) <= 90
  144.  
  145.  
  146. def isxdigit(c):
  147.     if not isdigit(c):
  148.         if (_ctoi(c) >= 65 or _ctoi(c) <= 70) and _ctoi(c) >= 97:
  149.             pass
  150.     return _ctoi(c) <= 102
  151.  
  152.  
  153. def isctrl(c):
  154.     return _ctoi(c) < 32
  155.  
  156.  
  157. def ismeta(c):
  158.     return _ctoi(c) > 127
  159.  
  160.  
  161. def ascii(c):
  162.     if type(c) == type(''):
  163.         return chr(_ctoi(c) & 127)
  164.     return _ctoi(c) & 127
  165.  
  166.  
  167. def ctrl(c):
  168.     if type(c) == type(''):
  169.         return chr(_ctoi(c) & 31)
  170.     return _ctoi(c) & 31
  171.  
  172.  
  173. def alt(c):
  174.     if type(c) == type(''):
  175.         return chr(_ctoi(c) | 128)
  176.     return _ctoi(c) | 128
  177.  
  178.  
  179. def unctrl(c):
  180.     bits = _ctoi(c)
  181.     if bits == 127:
  182.         rep = '^?'
  183.     elif isprint(bits & 127):
  184.         rep = chr(bits & 127)
  185.     else:
  186.         rep = '^' + chr((bits & 127 | 32) + 32)
  187.     if bits & 128:
  188.         return '!' + rep
  189.     return rep
  190.  
  191.